import os

os.environ["LANGSMITH_TRACING"] = "true"
os.environ["LANGSMITH_PROJECT"] = "default"

from langchain.chat_models import init_chat_model
from langchain_core.prompts import ChatPromptTemplate

model = init_chat_model(
    base_url="https://api.openai-proxy.org/v1",
    model="gpt-3.5-turbo",
    model_provider="openai",
    api_key=os.getenv("OPENAI_API_KEY")
)

system_template = "Translate the following from English into {language}"

prompt_template = ChatPromptTemplate.from_messages(
    [("system", system_template), ("user", "{text}")]
)

prompt = prompt_template.invoke({"language": "中文", "text": "hi!"})

response = model.invoke(prompt)
print(response)
